/*******************************************************************************
 * Size: 12 px
 * Bpp: 4
 * Opts: --no-compress --format lvgl --font HarmonyOS_Sans_SC_Medium.ttf -o Number_HarmonyOS_bpp4_12px.c --bpp 4 --size 12 -r 0x20-0x7f
 ******************************************************************************/

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif

#ifndef NUMBER_HARMONYOS_BPP4_12PX
#define NUMBER_HARMONYOS_BPP4_12PX 1
#endif

#if NUMBER_HARMONYOS_BPP4_12PX

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
#include "bin_font.h" 

/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

 
/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/



/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 32, .range_length = 95, .glyph_id_start = 1,
        .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
    }
};

/*-----------------
 *    KERNING
 *----------------*/


/*Map glyph_ids to kern left classes*/
static const uint8_t kern_left_class_mapping[] =
{
    0, 0, 0, 1, 0, 0, 0, 0,
    1, 2, 3, 0, 4, 0, 4, 0,
    5, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 4,
    6, 7, 8, 9, 10, 7, 11, 12,
    13, 14, 14, 15, 16, 17, 14, 14,
    7, 18, 0, 19, 20, 21, 15, 5,
    22, 23, 24, 25, 2, 8, 3, 0,
    0, 0, 26, 27, 28, 29, 30, 31,
    32, 26, 0, 33, 34, 29, 26, 26,
    27, 27, 0, 35, 36, 37, 32, 38,
    38, 39, 38, 40, 2, 0, 3, 4
};

/*Map glyph_ids to kern right classes*/
static const uint8_t kern_right_class_mapping[] =
{
    0, 1, 0, 2, 0, 0, 0, 0,
    2, 0, 3, 0, 4, 5, 4, 5,
    6, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 4, 0, 0,
    7, 8, 6, 9, 8, 9, 9, 9,
    8, 9, 9, 10, 9, 9, 9, 9,
    8, 9, 8, 9, 11, 12, 13, 14,
    15, 16, 17, 18, 0, 14, 3, 0,
    5, 0, 19, 20, 21, 21, 21, 22,
    21, 20, 0, 23, 20, 20, 24, 24,
    21, 0, 21, 24, 25, 26, 27, 28,
    28, 29, 30, 31, 0, 0, 3, 4
};

/*Kern values between classes*/
static const int8_t kern_class_values[] =
{
    0, 0, 0, 0, 0, 0, 3, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 4, 0, 4, 4,
    2, 0, 3, 0, 0, 13, 0, 0,
    3, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 5, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, -10, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, -8, 3, 4, -8,
    -27, -18, 4, -7, 0, -23, -2, 4,
    0, 0, 0, 0, 0, 0, -15, 0,
    -14, -5, 0, -9, -11, -1, -9, -9,
    -11, -9, -10, 0, 0, 0, -6, -19,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, -4, 0, 0, -8, -7,
    0, 0, 0, -7, 0, -6, 0, -7,
    -4, -7, -11, -4, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, -8, -22, 0, -12, 5, 0, -13,
    -7, 0, 0, 0, -16, -3, -18, -13,
    0, -21, 4, 0, 0, -2, 0, 0,
    0, 0, 0, 0, -8, 0, -8, 0,
    0, -2, 0, 0, 0, -3, 0, 0,
    0, 3, 0, -7, 0, -9, -3, 0,
    -11, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    2, 0, -6, 4, 0, 6, -3, 0,
    0, 0, 1, 0, -1, 0, 0, -1,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, -4, 0, -4, 0, 0, 0,
    0, 0, 2, 0, 2, -2, 0, 2,
    0, 0, 0, -2, 0, 0, -2, 0,
    -2, 0, -2, -3, 0, 0, -2, -2,
    -2, -4, -2, -4, 0, -2, 5, 0,
    1, -25, -11, 8, -1, 0, -27, 0,
    4, 0, 0, 0, 0, 0, 0, -8,
    0, -5, -2, 0, -3, 0, -2, 0,
    -4, -7, -4, -5, 0, 0, 0, 0,
    3, 0, 2, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 1, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, -6, -3,
    0, 0, 0, -6, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, -8, 0, 0, -21, 3, 0, -1,
    -11, -3, 0, -3, 0, -5, 0, 0,
    0, 0, 0, -6, 0, -7, -8, 0,
    -3, -3, -8, -8, -13, -7, -13, 0,
    -10, -20, 0, -17, 5, 0, -14, -9,
    0, 3, -2, -25, -8, -28, -21, 0,
    -34, 0, -1, 0, -4, -4, 0, 0,
    0, -5, -5, -18, 0, -18, 0, -2,
    2, 0, 2, -28, -16, 3, 0, 0,
    -31, 0, 0, 0, -1, -1, -5, 0,
    -6, -6, 0, -6, 0, 0, 0, 0,
    0, 0, 2, 0, 2, 0, 0, -2,
    0, -2, 7, 0, -1, -2, 0, 0,
    1, -2, -2, -5, -3, 0, -9, 0,
    0, 0, -2, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 2, 0, 0, 0, 4,
    0, 0, -3, 0, 0, -4, 1, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, -6, 6, 0, -15,
    -22, -16, 7, -6, 0, -27, 0, 4,
    0, 4, 4, 0, 0, 0, -23, 0,
    -21, -9, 0, -18, -21, -6, -17, -20,
    -21, -20, -17, -2, 3, 0, -5, -15,
    -13, 0, -4, 0, -14, 0, 4, 0,
    0, 0, 0, 0, 0, -15, 0, -12,
    -3, 0, -8, -9, 0, -7, -4, -6,
    -4, -7, 0, 0, 4, -18, 2, 0,
    2, -7, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, -5, 0, -7, 0,
    0, -3, -3, -6, -6, -12, 0, -12,
    0, -6, 3, 4, -14, -26, -21, 2,
    -11, 0, -26, -5, 0, 0, 0, 0,
    0, 0, 0, -22, 0, -21, -10, 0,
    -16, -18, -7, -15, -14, -13, -14, -15,
    0, 0, 2, -9, 4, 0, 2, -5,
    0, 0, -2, 0, 0, 0, 0, 0,
    0, 0, -1, 0, -3, 0, 0, 0,
    0, 0, 0, -6, 0, -6, 0, 0,
    -8, 0, 0, 0, 0, -6, 0, 0,
    0, 0, -17, 0, -14, -13, -2, -19,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, -2, 0, -2, 0, 0, -10,
    0, -2, -6, 0, -8, 0, 0, 0,
    0, -21, 0, -14, -12, -7, -21, 0,
    -2, 0, 0, -2, 0, 0, 0, -1,
    0, -4, -5, -4, -4, 0, 1, 0,
    3, 5, 0, -2, 0, 0, 0, 0,
    -15, 0, -10, -7, 3, -15, 0, 0,
    0, -1, 2, 0, 0, 0, 4, 0,
    0, 1, 0, 3, 0, 0, 3, 0,
    0, 0, 2, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, -1, 0, 3, -1,
    0, -5, 0, 0, 0, 0, -14, 0,
    -12, -9, -3, -18, 0, 0, 0, 0,
    0, 0, 0, 2, 0, 0, 0, -1,
    0, 0, 0, 9, 0, -1, -15, 0,
    9, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, -5, 0, -5, 0,
    0, 0, 0, 3, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, -5,
    0, 0, 0, 0, -18, 0, -9, -8,
    0, -16, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 2, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 8, 0,
    0, 0, 0, 0, 0, 0, 0, -4,
    0, 0, -5, 5, 0, -9, 0, 0,
    0, 0, -18, 0, -12, -11, 0, -16,
    0, -6, 0, -4, 0, 0, 0, -2,
    0, -2, 0, 0, 0, 0, 0, 5,
    0, 2, -21, -9, -6, 0, 0, -23,
    0, 0, 0, -8, 0, -10, -14, 0,
    -8, 0, -6, 0, 0, 0, -1, 6,
    0, 0, 0, 0, 0, 0, -6, 0,
    0, 0, 0, -6, 0, 0, 0, 0,
    -19, 0, -14, -10, -1, -20, 0, 0,
    0, 0, 0, 0, 0, 2, 0, 0,
    -2, 0, -2, 2, 0, -1, 2, 0,
    5, 0, -5, 0, 0, 0, 0, -13,
    0, -9, 0, 0, -13, 0, 0, 0,
    -2, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, -17,
    -8, -5, 0, 0, -15, 0, -20, 0,
    -9, -4, -12, -14, 0, -4, 0, -4,
    0, 0, 0, -2, 0, 0, 0, 0,
    0, 0, 0, 0, 0, -4, 2, 0,
    -8, 0, 0, 0, 0, -21, 0, -11,
    -6, 0, -13, 0, -3, 0, -5, 0,
    0, 0, 0, 2, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 2, 0, -6,
    0, 0, 0, 0, -19, 0, -11, -6,
    0, -14, 0, -3, 0, -4, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0
};


/*Collect the kern class' data in one place*/
static const lv_font_fmt_txt_kern_classes_t kern_classes =
{
    .class_pair_values   = kern_class_values,
    .left_class_mapping  = kern_left_class_mapping,
    .right_class_mapping = kern_right_class_mapping,
    .left_class_cnt      = 40,
    .right_class_cnt     = 31,
};

/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

#if LVGL_VERSION_MAJOR >= 8
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
    .glyph_bitmap = Number_HarmonyOS_bpp4_12px_glyph_bitmap,
    .glyph_dsc = Number_HarmonyOS_bpp4_12px_glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = &kern_classes,
    .kern_scale = 16,
    .cmap_num = 1,
    .bpp = 4,
    .kern_classes = 1,
    .bitmap_format = 0,
#if LVGL_VERSION_MAJOR >= 8
    .cache = &cache
#endif
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t Number_HarmonyOS_bpp4_12px = {
#else
lv_font_t Number_HarmonyOS_bpp4_12px = {
#endif
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 15,          /*The maximum line height required by the font*/
    .base_line = 3,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -1,
    .underline_thickness = 1,
#endif
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};



#endif /*#if NUMBER_HARMONYOS_BPP4_12PX*/

